home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2008 January / Mac_easy_01_08.iso / Software / Online / Chat / macam.0.9.1.dmg / macam source / utilities / LookUpTable.h < prev    next >
Encoding:
Text File  |  2006-07-25  |  2.8 KB  |  80 lines

  1. //
  2. //  LookUpTable.h
  3. //
  4. //  macam - webcam app and QuickTime driver component
  5. //
  6. //  Created by hxr on 6/20/06.
  7. //  Copyright (C) 2006 HXR (hxr@users.sourceforge.net). 
  8. //
  9. //  This program is free software; you can redistribute it and/or modify
  10. //  it under the terms of the GNU General Public License as published by
  11. //  the Free Software Foundation; either version 2 of the License, or
  12. //  (at your option) any later version.
  13. //
  14. //  This program is distributed in the hope that it will be useful,
  15. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. //  GNU General Public License for more details.
  18. //
  19. //  You should have received a copy of the GNU General Public License
  20. //  along with this program; if not, write to the Free Software
  21. //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
  22. //
  23.  
  24. //
  25. //  The LookUpTable was created to permit the adjustment of brightness, contrast, 
  26. //  saturation and gamma for those cameras that do not allow it in hardware, or 
  27. //  use a Bayer decoding structure that allows it. Consequently, the interface 
  28. //  follows the BayerDecoder; in fact, it may make sense to subclass the BayerDecoder
  29. //  from this class, as the BayerDecoder extends the interface. 
  30. //
  31.  
  32. #import <Cocoa/Cocoa.h>
  33.  
  34. @interface LookUpTable : NSObject 
  35. {
  36.     float contrast;
  37.     float brightness;
  38.     float gamma;
  39.     long saturation;
  40.     
  41.     unsigned char redTransferLookup[256];
  42.     unsigned char greenTransferLookup[256];
  43.     unsigned char blueTransferLookup[256];
  44.     
  45.     BOOL updateGains;
  46.     BOOL needsTransferLookup;
  47.     
  48.     // Individual gains for white balance correction
  49.     
  50.     float redGain;
  51.     float greenGain;
  52.     float blueGain;
  53. }
  54.  
  55. // Start/stop
  56. - (id) init;
  57.  
  58. // LUT functions
  59. - (UInt8) red: (UInt8) r  green: (int) g;
  60. - (UInt8) green: (UInt8) g;
  61. - (UInt8) blue: (UInt8) b  green: (int) g;
  62. - (void) processTriplet: (UInt8 *) tripletIn toHere: (UInt8 *) tripletOut;
  63. - (void) processImage: (UInt8 *) buffer numRows: (long) numRows rowBytes: (long) rowBytes bpp: (short) bpp invert: (BOOL) invert;
  64. - (void) processImageRep: (NSBitmapImageRep *) imageRep buffer: (UInt8 *) buffer numRows: (long) numRows rowBytes: (long) rowBytes bpp: (short) bpp;
  65.  
  66. // Get/set properties
  67. - (float) brightness;    //[-1.0 ... 1.0], 0.0 = no change, more = brighter
  68. - (void) setBrightness:(float) newBrightness;
  69. - (float) contrast;    //[0.0 ... 2.0], 1.0 = no change, more = more contrast
  70. - (void) setContrast:(float) newContrast;
  71. - (float) gamma;    //[0.0 ... 2.0], 1.0 = no change, more = darker grey
  72. - (void) setGamma:(float) newGamma;
  73. - (float) saturation;    //[0.0 ... 2.0], 1.0 = no change, less = less saturation
  74. - (void) setSaturation:(float) newSaturation;
  75. - (void) setGainsRed:(float)r green:(float)g blue:(float)b;
  76.  
  77. - (void) recalcTransferLookup;
  78.  
  79. @end
  80.